<template>
	<view>
		<scroll-view>
			<view v-for="item in videosList">
				<image :src="item.imgSrc" mode="aspectFill" lazy-load/>
				<text>{{item.title}}</text>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				starList:[],
				videosList:[],
			}
		},
		methods: {
			init(){
				for(let i=0;i<this.starList.length;i++){
					uni.request({
						url:this.baseUrl+'/getVideoPlay',
						method:'POST',
						header: { 'Content-Type': 'application/json' },
						data:{
							videoId:this.starList[i]
						},
						success: (res) => {
							console.log(res)
							const item={videoId:res.data.data.videoId,
							imgSrc:this.baseUrl+'/img/'+res.data.data.imgSrc,
							title:res.data.data.title}
							this.videosList.push(item);
						},
						fail: (err) => {
							console.log(err)
						}
					})
				}
			}
		},
		mounted() {
			this.starList = JSON.parse(uni.getStorageSync("starList") || "[]");
			this.init();
		}
	}
</script>

<style>

</style>
